<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/common/taglibs.jsp"%>
<link rel="stylesheet" type="text/css" href="${ctx}/styles/pop.css" media="screen"/>
<script type="text/javascript" src="${ctx}/scripts/jquery/jquery.form.js"></script>
<div class="pop_roster_request">
	<div class="pop_roster_request_tit">
		上传我的可爱形象
	</div>
	<form id="f_avatar" action="<c:url value='/user/saveavatar.do'/>" method="post" enctype="multipart/form-data">
		<input type="file" name="avatar" />
		<br/>
		<button type="submit" class="btn3" >保存形象</button>
	</form>
</div>
<script>
$("#f_avatar").ajaxForm({
	dataType:'xml', 
	type:'post',
	success: processAvatarResult
});
function processAvatarResult(result){
	if($(result).find('result').text().toUpperCase().indexOf("TRUE") >= 0){
		var path = $(result).find('content').text();
		$('#img_user_avatar').attr('src', ctx + "/"+path); 
		$.fn.colorbox.close();
	}else{
		alert("上传出错！请重新上传！");
	}
}
</script>